extends archetypes/content-with-menu.pug

include mixins/nav.pug

include mixins/documentationjs/description.pug
include mixins/documentationjs/type.pug
include mixins/documentationjs/struct.pug
include mixins/documentationjs/connector-usage.pug

block navigation
  - let headings = [{tag: 'h2', id: 'description', text: 'Description'}]
  - if(jsdoc.requirements != '') headings.push({tag: 'h2', id:'requirements', text:'Requirements'})
  - headings.push({tag: 'h2', id:'usage', text:'Usage'}, {tag:'h2', id:'structure', text: 'Options'});
  - if(jsdoc.examples && jsdoc.examples.length > 0) headings.push({tag:'h2', id:'example', text: 'Example'});
  - if(jsdoc.staticExamples && jsdoc.staticExamples.length > 0) headings.push({tag:'h2', id:'example', text: 'Example'});
  +nav(navPath, navigation, mainTitle || title, withHeadings && headings || [])

block content
  h2#description Description
    a.anchor(href=`${navPath}#description`)
  p
    +description(jsdoc.description)

  if jsdoc.requirements
    h2#requirements Requirements
      a.anchor(href=`${navPath}#requirements`)
    p
      +description(jsdoc.requirements)

  h2#usage Usage
    a.anchor(href=`${navPath}#usage`)
  +connectorUsage(jsdoc)

  h2#structure Connector options
    a.anchor(href=`${navPath}#structure`)
  each t in jsdoc.relatedTypes
    if t
      +struct(t, jsdoc.relatedTypes)

  if jsdoc.examples && jsdoc.examples.length > 0
    script(src="//code.jquery.com/jquery-3.2.1.slim.min.js")
    h2#example Example
      a.anchor(href=`${navPath}#example`)
    each example in jsdoc.examples
      p!=h.highlight(example.description)

  if jsdoc.staticExamples && jsdoc.staticExamples.length > 0
    h2#example Example
      a.anchor(href=`${navPath}#example`)
    each example in jsdoc.staticExamples
      div!=h.highlight(example.description, { runnable: false })
